home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gui4cli / install < prev    next >
Text File  |  1999-04-29  |  8KB  |  306 lines

  1. G4C
  2.  
  3. ; This is a program for the installation of Gui4Cli to your system.
  4. ; Click on it's icon to install.
  5.  
  6. ; Comodore's Installer would do a better job, but since I don't
  7. ; know how to write scripts for it, and since this is an other
  8. ; excuse for making a gui, here it is.
  9.  
  10. ; If you have any problems (God forbid), just install it by hand.
  11. ; Instructions are in the ReadMe.now file 
  12.  
  13.  
  14. WINBIG 171 12 320 139 "Install Gui4Cli"
  15. WinType 11110001
  16. WinOut "con:0/12/400/80/Gui4Cli Installation/CLOSE/AUTO/WAIT"
  17.  
  18. BOX 0 0 0 0 out button
  19. BOX 10 5 300 68 in button
  20. BOX 10 95 300 39 IN BUTTON
  21.  
  22. ;--------------------------------- Start up events --------------------
  23.  
  24. xOnLoad
  25.     extract Install GUIPATH path
  26.     cd $path
  27.  
  28.     ; --------- Check to find gui4cli
  29.  
  30.     joinfile $path Gui4Cli g4cname
  31.     ifexists file $g4cname
  32.         ; ok
  33.     else
  34.         ezreq "Gui4Cli not found.\nPlease read the ReadMe.now\nfile and try again" "OK" ''
  35.         Quit
  36.     endif
  37.  
  38.     ; --------- Set default variable values
  39.  
  40.     dir      = SYS:Gui4Cli
  41.     dirinfo = SYS:Gui4Cli.info
  42.     assign  = ON
  43.     dirmake = YES
  44.  
  45.     ; --------- Warn user if Gui4Cli already exists
  46.  
  47.     ifexists assign GUIs
  48.         if guis: F= $path
  49.             ; it's ok it's this dir
  50.         else
  51.             dirmake = NO
  52.             dir      = GUIs:
  53.             assign  = OFF
  54.             update Install 7 0
  55.             update Install 2 "Directory exists."
  56.         endif
  57.     endif
  58.     GuiOpen Install
  59.     update Install 1 $dir
  60.  
  61. xOnClose
  62.     Quit
  63.  
  64. ;------------------------------ Install Gui4Cli program -----------------
  65.  
  66. CTEXT 20 10 "Gui4Cli Installation" topaz.font 8 2 0 0001
  67.  
  68.  
  69. XBUTTON 210 10 89 14 "Browse.."
  70.     gdir = ''
  71.     ReqFile -1 -1 250 -60 "Choose path for Gui4Cli" DIR gdir $dir
  72.     if $gdir != ""
  73.         joinfile $gdir Gui4Cli dir
  74.         joinfile $gdir Gui4Cli.info dirinfo
  75.         ifexists DIR $dir
  76.             dirmake = NO
  77.             assign     = OFF
  78.             update Install 7 0
  79.             update Install 2 "Directory Gui4Cli exists"
  80.         else
  81.             dirmake = YES
  82.             assign     = ON
  83.             update Install 7 1
  84.             update Install 2 "Will create Directory Gui4Cli"
  85.         endif
  86.         update Install 1 $dir
  87.     endif
  88.  
  89.  
  90. TEXT 20 25 280 14 "sys:" 120 BOX
  91.     GadID 1
  92.  
  93.  
  94. TEXT 20 40 280 14 "Creates Directory named Gui4Cli" 60 NOBOX
  95.     GadID 2
  96.  
  97.  
  98. TEXT 20 55 280 14 "File Gui will be copied to c:" 50 NOBOX
  99.     GadID 3
  100.  
  101.  
  102. ;====================> Assign GUIs:
  103.  
  104. TEXT 20 80 236 11 "Add commands to User-Startup?" 30 NOBOX
  105.     GadID 4
  106.  
  107. XCHECKBOX 260 80 26 13 "" assign "ON" "OFF" ON
  108.     gadID 7
  109.  
  110.  
  111. ;----------------------- Run Install -------------------------------
  112.  
  113. XBUTTON 25 115 100 14 Install!
  114.  
  115.     SetWinTitle Install "Installing..."
  116.     guiwindow install wait
  117.     FailAt 10
  118.  
  119.     ; copy Gui
  120.     copy gui c:
  121.     update Install 3 "File Gui copied."
  122.     update Install 10 5     ; gauge
  123.  
  124.     ; Make G4C dir & dir icon
  125.     if $dirmake = YES
  126.         makedir $dir
  127.         copy g4cdrawer $dirinfo
  128.         update Install 2 "Gui4Cli dir created."
  129.         Assign GUIs: $dir
  130.     endif
  131.     update Install 10 10      ; gauge
  132.  
  133.     ; add the assign to s:user-startup
  134.     if $assign = ON
  135.         update Install 4 "Assigning..."
  136.         Append s:user-startup "\n;START of Gui4Cli assign\n"
  137.         Append s:user-startup 'Assign GUIs: $dir \n'
  138.         Append s:user-startup 'Path GUIs:c add\n'
  139.         Append s:user-startup ";END of Gui4Cli assign\n"
  140.         update Install 4 "GUIs: Assign added."
  141.     endif
  142.     update Install 10 15      ; gauge
  143.  
  144.     ; ----- copy the files
  145.  
  146.     ; tools
  147.     update Install 1 "Copying Tools..."
  148.     ; get & save new players
  149.     joinfile $dir "tools/prefs/players" playfile
  150.     ifexists file $playfile
  151.         guiload tools/prefs/players
  152.         guiload $playfile                  ; overlay old prefs
  153.         flag = 1
  154.     endif
  155.     action copy tools $dir
  156.     if $flag = 1
  157.         gosub install saveprefs
  158.     endif
  159.     ; check favourites files
  160.     gosub install savefavs
  161.     update Install 10 30
  162.  
  163.     ; C
  164.     update Install 1 "Copying C..."
  165.     copy c $dir
  166.     update Install 10 35
  167.  
  168.     ; docs
  169.     update Install 1 "Copying Docs..."
  170.     action copy docs $dir
  171.     update Install 10 50
  172.  
  173.     ; Ext
  174.     update Install 1 "Copying Ext..."
  175.     action copy ext $dir
  176.     update Install 10 60
  177.  
  178.     ; dir.gc
  179.     update Install 1 "Copying Dir.gc..."
  180.     joinfile $dir dir/dir.user userfile
  181.     ifexists file $userfile
  182.          rename dir/dir.user dir/dir.user.empty
  183.     endif
  184.     copy Dir $dir
  185.     update Install 10 70
  186.  
  187.     ; G4C
  188.     update Install 1 "Copying G4C..."
  189.     copy G4C $dir
  190.     update Install 10 80
  191.  
  192.     ; ------- copy the files
  193.     ; icons
  194.     update Install 1 "Copying Files..."
  195.     rename Install.info ginfo            ; so that it's not copied
  196.     copy #?.info $dir
  197.     rename ginfo Install.info
  198.     update Install 10 85
  199.  
  200.     ifexists file c:Gui4Cli
  201.         delete c:Gui4Cli
  202.     endif
  203.     copy Gui4Cli $dir
  204.     update Install 10 95
  205.  
  206.     copy Gui4Cli.gc      $dir
  207.     copy Demo.gc          $dir
  208.     copy ReadMe.now      $dir
  209.     update Install 10 100
  210.  
  211.     update Install 1 "Gui4Cli Installed."
  212.  
  213.     cli 'c:path guis:c add'
  214.     SetWinTitle Install "Gui4Cli Installation"
  215.     guiwindow install resume
  216.     ezreq "Installation finished.\nGui4Cli can be found in\n$dir" "Yeah!" ""
  217.  
  218.     ; quit since this is another port
  219.     ifexists port Gui4Cli
  220.         else
  221.         run 'gui guis:Gui4Cli.gc'
  222.     endif
  223.     Quit
  224.  
  225. ;------------> On failing
  226.  
  227. xOnFail
  228.     SetWinTitle Install "**** ERROR ****"
  229.     guiwindow install resume
  230.     EZREQ "ERROR in installation\nPlease read the ReadMe.Now file\nand install manually." "OK" ""
  231.     Quit
  232.  
  233. ;----------------------- Cancel button ------------------------------
  234.  
  235. XBUTTON 200 115 100 14 CANCEL
  236.     Quit
  237.  
  238.  
  239. GAUGE 22 99 281 13 IN RIDGE 3 0 0
  240.     gadid 10
  241.  
  242.  
  243. ; --------------------------- ROUTINES -------------------------
  244. ; Same routine as in guis:tools/config.gc
  245.  
  246. xroutine saveprefs
  247.     .dir.prefs = "G4C - Players\n\nxOnLoad\n"
  248.     append env:.dir.prefs '*DEF.EDITOR      = \"$*DEF.EDITOR\"\n'
  249.     append env:.dir.prefs '*DEF.ILBM          = \"$*DEF.ILBM\"\n'
  250.     append env:.dir.prefs '*DEF.ANIM          = \"$*DEF.ANIM\"\n'
  251.     append env:.dir.prefs '*DEF.GIF          = \"$*DEF.GIF\"\n'
  252.     append env:.dir.prefs '*DEF.JPG          = \"$*DEF.JPG\"\n'
  253.     append env:.dir.prefs '*DEF.GFX          = \"$*DEF.GFX\"\n'
  254.     append env:.dir.prefs '*DEF.PAINT      = \"$*DEF.PAINT\"\n'
  255.     append env:.dir.prefs '*DEF.GFXCON      = \"$*DEF.GFXCON\"\n'
  256.     append env:.dir.prefs '*DEF.SMPL          = \"$*DEF.SMPL\"\n'
  257.     append env:.dir.prefs '*DEF.MOD          = \"$*DEF.MOD\"\n'
  258.     append env:.dir.prefs '*DEF.GUIDE      = \"$*DEF.GUIDE\"\n'
  259.     append env:.dir.prefs '*DEF.LHA          = \"$*DEF.LHA\"\n'
  260.     append env:.dir.prefs '*DEF.ZIP          = \"$*DEF.ZIP\"\n'
  261.     append env:.dir.prefs '*DEF.UNZIP      = \"$*DEF.UNZIP\"\n'
  262.     append env:.dir.prefs '*DEF.HEX          = \"$*DEF.HEX\"\n'
  263.     append env:.dir.prefs '*DEF.PP          = \"$*DEF.PP\"\n'
  264.     append env:.dir.prefs '*DEF.PPM          = \"$*DEF.PPM\"\n'
  265.     append env:.dir.prefs '*DEF.TGA          = \"$*DEF.TGA\"\n'
  266.     append env:.dir.prefs '*DEF.PNG          = \"$*DEF.PNG\"\n'
  267.     append env:.dir.prefs '*DEF.FONT          = \"$*DEF.FONT\"\n'
  268.     append env:.dir.prefs '*DEF.HTML          = \"$*DEF.HTML\"\n'
  269.     append env:.dir.prefs '*DEF.GFXED      = \"$*DEF.GFXED\"\n'
  270.     append env:.dir.prefs '*DEF.FLC          = \"$*DEF.FLC\"\n'
  271.     append env:.dir.prefs '*DEF.AVI          = \"$*DEF.AVI\"\n'
  272.     append env:.dir.prefs '*DEF.MPG          = \"$*DEF.MPG\"\n'
  273.     append env:.dir.prefs '*DEF.QT          = \"$*DEF.QT\"\n'
  274.     append env:.dir.prefs '*DEF.MPGA          = \"$*DEF.MPGA\"\n'
  275.     append env:.dir.prefs '*DEF.DT          = \"$*DEF.DT\"\n'
  276.     append env:.dir.prefs "GuiQuit Players\n" 
  277.     copy env:.dir.prefs guis:tools/prefs/players
  278.     delete env:.dir.prefs
  279.  
  280. xROUTINE savefavs
  281.     .temp = "GUIs:"
  282.     ; check if fav directory exists
  283.     joinfile $dir "tools/fav" favdir
  284.     ifexists directory $favdir
  285.         else
  286.         makedir $favdir
  287.     endif
  288.     ; check & create fav files
  289.     joinfile $dir "tools/fav/dirdef" favfile
  290.     ifexists file $favfile            ; dir favourites files
  291.         else
  292.         copy env:.temp $favfile
  293.     endif
  294.     joinfile $dir "tools/fav/cedfav" favfile
  295.     ifexists file $favfile            ; ced
  296.         else
  297.         copy env:.temp $favfile
  298.     endif
  299.     joinfile $dir "tools/fav/default" favfile
  300.     ifexists file $favfile            ; default
  301.         else
  302.         copy env:.temp $favfile
  303.     endif
  304.  
  305.  
  306.